<%@page import="com.jkoss.pojo.oa.Empattendance"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>列出工作岗位</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../css/four.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../css/jqe/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../css/jqe/themes/icon.css"/>

    <script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>

    <script type="text/javascript">
 
        $(function(){
         	//初始化对话框
        	 $('#dw,#spdw').window({
       		   onBeforeClose:function(){ 
       			   //取消时关闭等待框
       			   setTimeout(function(){ 
       				   sending.style.visibility = "hidden";
					   }, 250);
       	    }});
       	
            $(".btnAll").each(function(i,v){
         	   //变手型
         	     $(v).mouseover(function() {
     				$(this).css("cursor", "hand");
     			 }).mouseout(function() {
     				$(this).css("cursor", "pointer");
     			 });
         	   
          	   if($(v).html()=='【填写异常】'){
          		   $(v).click(function(){
          			   $('#dw_p').html($(v).prop("title")+":");
          			   $("#dw_add").prop("lang",$(v).prop("lang"));
          			   $('#dw').window("open");
          		   });
          	   }else if($(v).html()=="【审批异常】"){
        		   $(v).click(function(){
        			   $('#dw_p2').html($(v).prop("title")+":");
        			   $("#dw_sp").prop("lang",$(v).prop("lang"));
        			   $("#spdw").window("open");
        		   });
        	    } 
            });
            
            $("#dw_add").click(function(){
            	   $.get(encodeURI("kqRs.do?kqid="+ $(this).prop("lang")+"&msg="+$('#dw_t').html()),function(jsonTxt){
        			      if("添加成功"==jsonTxt){
        			    	  $("#upd"+$("#dw_add").prop("lang")).parent().html("【"+jsonTxt+"】");
        			    	  $("#kqresult"+$("#dw_add").prop("lang")).html($('#dw_t').html());
        			      }
        			      $('#dw_p').html("") ;
        			      $('#dw_t').html("")
        			  	  $('#dw').window("close");
            	   });  
            });
            
            $("#dw_sp").click(function(){
         	   $.get("spkqRs.do?kqid="+ $(this).prop("lang")+"&x="+Math.random(),function(jsonTxt){
     			      if("我已确认"==jsonTxt){
     			    	  $("#spd"+$("#dw_sp").prop("lang")).parent().html("【"+jsonTxt+"】");
     			      }
     			  	  $('#spdw').window("close");
         	   });  
         });
            
        });
    </script>
</head>
<body>
	<!-- 包含等待框 -->
	<jsp:include page="../waittable.jsp" flush="true" />
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr valign="top">
			<td bgcolor="#FFFFFF"><table width="96%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
					<tr align="left" bgcolor="#F2FDFF">
						<td colspan="5" class="optiontitle">
						 <select name="slkt_dps">
						       <option    value="0">全部</option>
						    <c:forEach items="${dpts}" var="dpt">
						       <option ${dpt.depID==lgnUsr.ejob.depID?"selected='selected'":""} value="${dpt.depID}">${dpt.depname}</option>
						    </c:forEach>
						 </select>
						</td>
					</tr>
					<tr align="left" bgcolor="#F2FDFF">
						<td colspan="5" class="optiontitle">
						    ${emp.ename}的[${mth}月份]考勤:
						</td>
					</tr>
				  	<tr align="center">
						<td align="center" bgcolor="#ebf0f7">考勤日期</td>
						<td align="center" bgcolor="#ebf0f7">签到时间</td>
						<td align="center" bgcolor="#ebf0f7">签出时间</td>
						<td align="center" bgcolor="#ebf0f7">异常缘由</td>
						<td align="center" bgcolor="#ebf0f7">操作   </td>
					</tr>
					<c:forEach items="${empKqs}" var="empKq">
					    <c:set var="need1" value="0"/>
						<tr align="center" bgcolor="#FFFFFF">
							<td align="center">
<<<<<<< HEAD
							     <fmt:formatDate value="${empKq.kqdate1}" pattern="yyyy-MM-dd" />
							</td>
=======
							     <fmt:formatDate value="${empKq.kqdate1}" pattern="yyyy-MM-dd [EEE]" />
							     </td>
>>>>>>> refs/heads/FristTeam
							   <% Empattendance empKq = (Empattendance) pageContext.getAttribute("empKq");
							      long Kqdate1 = empKq.getKqdate1().getTime();
							      long Kqdate1Base =com.jkoss.tool.DbCommonMethod.isoFormat.parse(com.jkoss.tool.DbCommonMethod.isoFormat.format(empKq.getKqdate1())).getTime() ;
							  
							      if((Kqdate1 -Kqdate1Base )>(9*1000*60*60+1000*60*30) ){
							    	%>
							    	    <td align="center"  style="color: red" >  
							    	    <c:set var="need1" value="1"/>
							       <%}else{%>
							    	   <td align="center"  >  
							       <%}%>
							    <fmt:formatDate value="${empKq.kqdate1}" pattern="HH:mm:ss" />
							</td>
						       <%
							      long Kqdate2 = empKq.getKqdate2().getTime();
							      long Kqdate2Base =com.jkoss.tool.DbCommonMethod.isoFormat.parse(com.jkoss.tool.DbCommonMethod.isoFormat.format(empKq.getKqdate2())).getTime() ;
							  
							      if((Kqdate2 -Kqdate2Base )<(17*1000*60*60+1000*60*30) ){
							    	%>
							    	   <td align="center"  style="color: red" >  
							    	    <c:set var="need1" value="2"/>
							       <%}else{%>
							    	   <td align="center"  >  
							       <%}%>
			                       <fmt:formatDate value="${empKq.kqdate2}" pattern="HH:mm:ss" /></td>
							<td align="center" id="kqresult${empKq.kqid}" >${empKq.kqresult}</td>
							<td align="left">
									<c:choose>
									  <c:when test="${need1>0 and empKq.kqresult==null}">
									      <span  class="btnAll" lang="${empKq.kqid}" id="upd${empKq.kqid}"  title="<fmt:formatDate value='${empKq.kqdate1}' pattern='yyyy-MM-dd' />"  style="color: red">【填写异常】</span>
									  </c:when>
									  <c:when test="${need1>0 and empKq.kqresult!=null}">
									       <c:if test="${empKq.kqbreak==null}">
									          | <span     lang="${empKq.kqid}"  style="color: blue">【异常待批】</span>
									          | <span class="btnAll" title="<fmt:formatDate value='${empKq.kqdate1}' pattern='yyyy-MM-dd' />"   id="spd${empKq.kqid}" lang="${empKq.kqid}">【审批异常】</span>
									       </c:if>
									         <c:if test="${empKq.kqbreak!=null}">
									          | <span    style="color: green">【已批准】</span>
									       </c:if>
									  </c:when>
									  <c:otherwise>
									     <span    style="color: green">【考勤正常】</span>
									  </c:otherwise>
									</c:choose>
							 
									     
 
									  
							</td>
						</tr>
					</c:forEach>
				</table>
			</td>
		</tr>
	</table>
  
  	 <div id="dw" class="easyui-window" title="添加异常考勤说明信息" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:200px;padding:10px;display: none;">
             <p id="dw_p"></p>
		     <textarea  id="dw_t" name="dnote" rows="4" cols="40" id="upd_dnote"></textarea><br><br>
		     <input type="button"  id="dw_add" lang="" value="添加" /><br>
	</div>
    <div id="spdw" class="easyui-window" title="确认员工异常考勤申请" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:250px;height:150px;padding:10px;display: none;">
             <p id="dw_p2"></p>
		     <p>异常考勤一旦确认，将由您负责，该次异常不计入员工 行考核.</p>   
		     <input type="button"  id="dw_sp" lang="" value="情况属实"/><br>
	</div>
  
  
	 
</body>
</html>